package com.iss.okair.db.mapper.transsql;

import com.iss.okair.db.entity.AssetsTranUse;
import com.iss.okair.db.entity.Assetstrans;
import org.apache.ibatis.jdbc.SQL;

public class NormalTransSQL {
    public String select(AssetsTranUse model){
        return new SQL(){{
            SELECT("*");
            FROM("checkinlist c JOIN assets_normal f on c.assetsCode= f.assetsCode");
            if(model.getAssetsnamecn()!=null && !model.getAssetsnamecn().isEmpty()){
                WHERE ("assetsnamecn  like '%"+model.getAssetsnamecn()+"%'");
            }
            if(model.getBatchno()!=null && !model.getBatchno().isEmpty()){
                WHERE("batchno like '%"+model.getBatchno()+"%'");
            }

        }}.toString();

    }
    public String selectout(AssetsTranUse model){
        return new SQL(){{
            SELECT("*");
            FROM("checkoutlist c JOIN assets_normal f on c.assetsCode= f.assetsCode");
            if(model.getAssetsnamecn()!=null && !model.getAssetsnamecn().isEmpty()){
                WHERE ("assetsnamecn  like '%"+model.getAssetsnamecn()+"%'");
            }
            if(model.getBatchno()!=null && !model.getBatchno().isEmpty()){
                WHERE("batchno like '%"+model.getBatchno()+"%'");
            }

        }}.toString();

    }
}
